#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT(riskclient, 0.1, gsenno at gmail.com)
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

# Checks for programs.
AC_PROG_CXX
AC_CHECK_PROG(HAVE_SDL_CONFIG, sdl-config, true, false)
AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)

# Checks for libraries.

dnl Si sdl-config existe, lo uso.

AM_CONDITIONAL(HAVE_SDL_CONFIG,$HAVE_SDL_CONFIG)

SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION,[
        HAVE_SDL=yes
        SDL_LIBS=`$SDL_CONFIG --libs`
],AC_MSG_WARN([*** No se pudo encontrar SDL -- riskclient no se va a compilar ***]))

AM_PATH_SDL($SDL_VERSION,[
        HAVE_SDL=yes
        SDL_CFLAGS=`$SDL_CONFIG --cflags`
],AC_MSG_WARN([*** No se pudo encontrar SDL -- riskclient no se va a compilar ***]))

dnl Si pkg-config existe, lo uso para compilar con soporte para gtkmm.

if test "x$HAVE_PKG_CONFIG" = "xyes"
	then
 	    PKG_CHECK_MODULES(PACKAGE,
 	    gtk+-2.0 \
 	    gthread-2.0 \
 	    gtkmm-2.4 \
 	    gtkglextmm-1.2)
		AC_SUBST(PACKAGE_CFLAGS)
		AC_SUBST(PACKAGE_LIBS)
fi



# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T

AC_PROG_RANLIB

AC_OUTPUT([
	Makefile
	src/Makefile
])
